﻿using Purchase.Infrastructrue.Implenment;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Purchase.Infrastructrue.Interface 
{
    public class BaseRepostity<T> : IBaseRepostity<T> where T : class, new()
    {
        private readonly MyContext db;

        public BaseRepostity(MyContext db)
        {
            this.db = db;
        }

        

        public IQueryable<T> GetAll()
        {
            return db.Set<T>();
        }

        public IQueryable<T> GetAllAsync(Expression<Func<T, bool>> expression)
        {
            return db.Set<T>().Where(expression).AsQueryable();
        }
    }
}
